package cn.tmpan.controller.test;

import cn.tmpan.common.ServerResponse;
import cn.tmpan.util.PropertiesUtil;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/test/")
public class test {
    private Logger logger = LoggerFactory.getLogger(test.class);

    @RequestMapping(value = "getUserInfo", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse test() {
        logger.info("开始时间{}",System.currentTimeMillis());

        Map map = Maps.newHashMap();

        map.put("name", "潘铁民");
        map.put("age", 26);

        return ServerResponse.createBySuccessData(map);
    }

    /**
     * 测试读取配置文件是否会中文乱码
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(PropertiesUtil.getProperty("test"));

    }
}
